import os
from script_convert_rating import amazon_ratings, amazon_reviews, movielens_ratings, goodreads_ratings, \
    book_crossing_ratings, yahoomusic_ratings, yelp_ratings, yahoomusic_big_ratings, steam_ratings, netflix_ratings

if __name__ == '__main__':
    input_dir = os.path.join('/home', 'bianzheng', 'CLionProjects', 'rec2-mips', 'Recommendation')
    output_dir = os.path.join('/home', 'bianzheng', 'CLionProjects', 'rec2-mips', 'intermediate-rating-csv')

    amazon_input = os.path.join(input_dir, 'amazon', 'all_csv_files.csv')
    amazon_output = os.path.join(output_dir, 'amazon.csv')
    # amazon_input = os.path.join(input_dir, 'amazon', 'test_amazon.csv')
    # amazon_output = os.path.join(output_dir, 'test_amazon.csv')
    amazon_ratings.convert_ratings(amazon_input, amazon_output)

    amazon_reviews_input = os.path.join(input_dir, 'amazon', 'Magazine_Subscriptions.json')
    # amazon_reviews_input = os.path.join(input_dir, 'amazon', 'test_magazine.json')
    amazon_reviews_output = os.path.join(output_dir, 'amazon_magazine.csv')
    amazon_reviews.convert_ratings(amazon_reviews_input, amazon_reviews_output)

    book_crossing_input = os.path.join(input_dir, 'Book-crossing', 'BX-Book-Ratings.csv')
    # book_crossing_input = os.path.join(input_dir, 'Book-crossing', 'test.csv')
    book_crossing_output = os.path.join(output_dir, 'book-crossing.csv')
    book_crossing_ratings.convert_ratings(book_crossing_input, book_crossing_output)

    goodreads_input = os.path.join(input_dir, 'Goodreads', 'goodreads_interactions.csv')
    # goodreads_input = os.path.join(input_dir, 'Goodreads', 'test.csv')
    goodreads_output = os.path.join(output_dir, 'goodreads.csv')
    goodreads_ratings.convert_ratings(goodreads_input, goodreads_output)

    movielens_input = os.path.join(input_dir, 'movielens-27m', 'ratings.csv')
    movielens_output = os.path.join(output_dir, 'movielens-27m.csv')
    # movielens_input = os.path.join(input_dir, 'movielens-small', 'ratings.csv')
    # movielens_output = os.path.join(output_dir, 'movielens-small.csv')
    movielens_ratings.convert_ratings(movielens_input, movielens_output)

    netflix_input = os.path.join(input_dir, 'netflix')
    netflix_output = os.path.join(output_dir, 'netflix.csv')
    netflix_ratings.convert_ratings(netflix_input, netflix_output)

    steam_input = os.path.join(input_dir, 'steam', 'steam_reviews.json')
    # steam_input = os.path.join(input_dir, 'steam', 'test.json')
    steam_output = os.path.join(output_dir, 'steam.csv')
    steam_ratings.convert_ratings(steam_input, steam_output)

    yahoomusic_big_input = os.path.join(input_dir, 'yahoomusic_big')
    yahoomusic_big_output = os.path.join(output_dir, 'yahoomusic_big.csv')
    yahoomusic_big_ratings.convert_ratings(yahoomusic_big_input, yahoomusic_big_output)

    yahoomusic_input = os.path.join(input_dir, 'yahoomusic', 'ydata-ymusic-artist-names-v1_0.txt')
    # yahoomusic_input = os.path.join(input_dir, 'yahoomusic', 'test.txt')
    yahoomusic_output = os.path.join(output_dir, 'yahoomusic.csv')
    yahoomusic_ratings.convert_ratings(yahoomusic_input, yahoomusic_output)

    yelp_input = os.path.join(input_dir, 'yelp', 'yelp_academic_dataset_review.json')
    # yelp_input = os.path.join(input_dir, 'yelp', 'test.json')
    yelp_output = os.path.join(output_dir, 'yelp.csv')
    yelp_ratings.convert_ratings(yelp_input, yelp_output)


